<?php

/**
 * Subclass for performing query and update operations on the 'causa' table.
 *
 * 
 *
 * @package lib.model
 */ 
class CausaPeer extends BaseCausaPeer
{
	public static function getCausasAcreedorFiltroDeEstado($acreedor,$filtroCausa){
	
		$criteria = new Criteria();
  		$criteria->addJoin(ContratoPeer::ACREEDOR_ID, AcreedorPeer::ID);
  		$criteria->addJoin(CausaPeer::CONTRATO_ID, ContratoPeer::ID);
  		$criteria->add(ContratoPeer::ACREEDOR_ID,$acreedor->getId());
  		$criteria->addJoin(CausaPeer::ID,EstadoCausaPeer::CAUSA_ID);
  		$criteria->add(EstadoCausaPeer::ACTIVO,1);
  	
  		$lista = null;
  		
  		for($i = 0; $i < count($filtroCausa); $i++){
  			if($filtroCausa[$i]){$lista[$i] = $i+1;}	
  		}

  		$criteria->add(EstadoCausaPeer::ESTADO_ID,$lista,Criteria::IN);
  		return CausaPeer::doSelect($criteria);
	}
}
